package ch.elca.lol.puissance4.player;

import ch.elca.lol.puissance4.board.Board;
import ch.elca.lol.puissance4.game.Token;
import ch.elca.lol.puissance4.util.Util;

/** Reads input from stdin (most likely: someone typing in the console). */
public class HumanPlayer extends PlayerHelper {
	private String name;
	
	@Override
	public void setToken(Token t) {
		super.setToken(t);
		
		System.out.print("Please, [" + getToken() + "], enter your name: ");
		this.name = Util.stdinNextLine();
	}
	
	@Override
	public int play(Board b) {
		System.out.print("Please, " + name + ", choose a column [1-" + (b.getWidth()) + "]: ");
		return Util.stdinNextInt() - 1;
	}
	
	@Override
	public String toString() {
		return name;
	}
	
}
